<?php if (!defined('THINK_PATH')) exit();?>﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>转诊记录</title>
    <link rel="stylesheet" href="/yilianti/Public/home/js/layui/css/layui.css"/>
    <script src="/yilianti/Public/home/js/layui/layui.js"></script>
    <script src="/yilianti/Public/home/js/jquery.js" type="text/javascript" charset="utf-8"></script>
    <script src="/yilianti/Public/home/js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/yilianti/Public/home/js/TouchSlide.1.1.js"></script>
    <script src="/yilianti/Public/home/js/jQuery.textSlider.js"></script>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" href="/yilianti/Public/home/css/weui.css"/>
    <link rel="stylesheet" href="/yilianti/Public/home/css/myself.css"/>
    <script>
        layui.use('layer', function(){
            var layer = layui.layer;
        });
    </script>
</head>
<body>
<!--

-->


    <input type="hidden" name="page" id="page">
    <div class="page__bd">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">疾病类型</label></div>
            <div class="weui-cell__bd sele_xial ">
                <select class="weui-select input_border " name="cateid" id="cateid">
                    <option value="0">全部</option>
                    <?php if(is_array($catelist)): foreach($catelist as $key=>$vo): ?><option value="<?php echo ($vo['id']); ?>"><?php echo ($vo['title']); ?></option><?php endforeach; endif; ?>
                </select>
            </div>
            <div class="weui-cell__hd"><label class="weui-label" style="
    text-align: center;
">   状态</label></div>
            <div class="weui-cell__bd sele_xial ">
                <select class="weui-select input_border " name="state" id="state">
                    <option value="0">全部</option>
                    <?php if(is_array($statelist)): foreach($statelist as $key=>$vo): ?><option value="<?php echo ($vo['id']); ?>"><?php echo ($vo['title']); ?></option><?php endforeach; endif; ?>
                </select>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">起止时间</label></div>
            <div class="weui-cell__bd">
                <!---->
                <div class="weui-cell__bd">
                    <input class="weui-input center_riqi fl input_border" type="date" value="<?php echo ($starttime); ?>" name="starttime" id="starttime">
                    <input class="weui-input center_riqi fr input_border"  type="date" value="<?php echo ($endtime); ?>" name="endtime" id="endtime">
                </div>
            </div>
        </div>
        <div class="weui-cell xian_bottom">
            <input type="text" class="center_search input_border bingli_ser fl" placeholder="请输入患者姓名" name="paname" id="paname"/>
            <a href="javascript:;" class="weui-btn weui-btn_mini  bingli_but " id="searchreferral">搜索</a>
        </div>
        <div class="page__bd">
            <div id="searchResult">
        <!--<div class="weui-form-preview__bd center_list_one">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">患者姓名：</label>
                <span class="weui-form-preview__value">张三</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">疾病类型：</label>
                <span class="weui-form-preview__value">艾滋病</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">时间：</label>
                <span class="weui-form-preview__value">2017.01.27</span>
            </div>
            <div id="" class="chuo chuo_zhuanc">
                转出
            </div>
        </div>-->
        </div>
            <div id="showmsg"></div>
            <input type="button" id="more" class="listmore" value="加载更多">
        </div>
    </div>
    <script type="text/javascript">
        var page = $("#page").val();
        if(!page){
            page = 1;
        }
        var cateid      = $("#cateid").val();
        var state       = $("#state").val();
        var starttime   = $("#starttime").val();
        var endtime     = $("#endtime").val();
        var paname      = $("#paname").val();
        referralist(page,cateid,state,starttime,endtime,paname);
        $("#searchreferral").click(function(){
            var page        = $("#page").val();
            var cateid      = $("#cateid").val();
            var state       = $("#state").val();
            var starttime   = $("#starttime").val();
            var endtime     = $("#endtime").val();
            var paname      = $("#paname").val();
            $("#searchResult").html('');
            $("#more").show();
            referralist(1,cateid,state,starttime,endtime,paname);
        });
        $("#more").click(function(){
            var page        = $("#page").val();
            var cateid      = $("#cateid").val();
            var state       = $("#state").val();
            var starttime   = $("#starttime").val();
            var endtime     = $("#endtime").val();
            var paname      = $("#paname").val();
            referralist(page,cateid,state,starttime,endtime,paname);
        });
        function referralist(page,cateid,state,starttime,endtime,paname){
            $.ajax({
                type:'post',
                url:'/yilianti/index.php/User/referrallist',
                data:{page:page,cateid:cateid,state:state,starttime:starttime,endtime:endtime,paname:paname},
                cache:false,
                dataType:'json',
                success:function(res){
                    if (res.code == 0) {
                        var arr = res.data;
                        var str = '';
                        $.each(arr, function (i) {
                            if(res.uid == this.hospital_pre){
                                str += '<a href="/yilianti/index.php/User/referral_detail/id/' + this.id + '" class="weui-form-preview__bd center_list_one"><div class="weui-form-preview__item"><label class="weui-form-preview__label">目标医院：</label><span class="weui-form-preview__value">' + this.hospital_now_name + '</span></div><div class="weui-form-preview__item"><label class="weui-form-preview__label">患者姓名：</label><span class="weui-form-preview__value">' + this.pname + '</span></div><div class="weui-form-preview__item"> <label class="weui-form-preview__label">疾病类型：</label><span class="weui-form-preview__value">' + this.catename + '</span></div> <div class="weui-form-preview__item"><label class="weui-form-preview__label">时间：</label><span class="weui-form-preview__value">' + this.addtime + '</span> </div><span style="text-indent:0; z-index:3; " class="chuo chuo_zhuanc state" data-id="' + this.id + '" data-stateid="' + this.stateid + '">' + this.state + '</span></a>';
                            }else{
                                str += '<a href="/yilianti/index.php/User/referral_detail/id/' + this.id + '" class="weui-form-preview__bd center_list_one"><div class="weui-form-preview__item"><label class="weui-form-preview__label">目标医院：</label><span class="weui-form-preview__value">' + this.hospital_now_name + '</span></div><div class="weui-form-preview__item"><label class="weui-form-preview__label">患者姓名：</label><span class="weui-form-preview__value">' + this.pname + '</span></div><div class="weui-form-preview__item"> <label class="weui-form-preview__label">疾病类型：</label><span class="weui-form-preview__value">' + this.catename + '</span></div> <div class="weui-form-preview__item"><label class="weui-form-preview__label">时间：</label><span class="weui-form-preview__value">' + this.addtime + '</span> </div><span style="text-indent:0; z-index:3; " class="chuo chuo_zhuanc state" data-id="' + this.id + '" data-stateid="' + this.stateid + '">' + this.state2 + '</span></a>';
                            }
                        });
                        $("#page").val(res.page);
                        $("#searchResult").append(str);
                    } else {
                        var str2 = '';
                        str2 += '<div class="nomore"><p>' + res.msg + '</p></div>';
                        $("#searchResult").append(str2);
                        $("#more").hide();
                    }
                }
            });
        }
        layui.use('layer', function(){
            var layer = layui.layer;
        });
        /*$(document).on('click',".state",function(){
            var id          = $(this).attr('data-id');
            var stateid     = $(this).attr('data-stateid');
            layer.confirm('确定操作吗？', {
                btn: ['重要','取消'] //按钮
            }, function(){
                $.ajax({
                    type:'post',
                    url:'/yilianti/index.php/User/state',
                    data:{id:id,stateid:stateid},
                    cache:false,
                    dataType:'json',
                    success:function(res){
                        if(res.code == 0){
                            layer.msg(res.msg,function () {
                                window.location.href = res.url;
                            });
                            return false;
                        }else{
                            layer.msg(res.msg);
                            return false;
                        }
                    }
                });
            }, function(){

            });
        });*/
    </script>



    <div class="weui-tabbar">
        <a href="/yilianti/index.php/Index/index" class="weui-tabbar__item weui-bar__item_on">
                <span style="display: inline-block;position: relative;">
                    <img src="/yilianti/Public/home/img/ind_01.png" alt="" class="weui-tabbar__icon">

                </span>
            <p class="weui-tabbar__label">首页</p>
        </a>
        <a href="/yilianti/index.php/Article/index" class="weui-tabbar__item">
            <img src="/yilianti/Public/home/img/ind_02.png" alt="" class="weui-tabbar__icon">
            <p class="weui-tabbar__label">新闻动态</p>
        </a>
        <a href="/yilianti/index.php/Referral/index" class="weui-tabbar__item">
                <span style="display: inline-block;position: relative;">
                    <img src="/yilianti/Public/home/img/ind_03.png" alt="" class="weui-tabbar__icon">

                </span>
            <p class="weui-tabbar__label">转诊会诊</p>
        </a>
        <a href="/yilianti/index.php/User/userlist" class="weui-tabbar__item">
            <img src="/yilianti/Public/home/img/ind_04.png" alt="" class="weui-tabbar__icon">
            <p class="weui-tabbar__label">个人中心</p>
        </a>
    </div>
    <script type="text/javascript">
        $(function(){
            $('.weui-tabbar__item').on('click', function () {
                $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
            });
        });
    </script>
    <script type="text/javascript" class="uploader js_show">
        $(function(){
            var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
                $gallery = $("#gallery"), $galleryImg = $("#galleryImg"),
                $uploaderInput = $("#uploaderInput"),
                $uploaderFiles = $("#uploaderFiles")
                ;

            $uploaderInput.on("change", function(e){
                var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
                for (var i = 0, len = files.length; i < len; ++i) {
                    var file = files[i];

                    if (url) {
                        src = url.createObjectURL(file);
                    } else {
                        src = e.target.result;
                    }

                    $uploaderFiles.append($(tmpl.replace('#url#', src)));
                }
            });
            $uploaderFiles.on("click", "li", function(){
                $galleryImg.attr("style", this.getAttribute("style"));
                $gallery.fadeIn(100);
            });
            $gallery.on("click", function(){
                $gallery.fadeOut(100);
            });
        });
    </script>


</body>
</html>